package com.ptswitch.material.components;

import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SetupRender;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.slf4j.Logger;

import com.ptswitch.material.model.material.Material;
import com.ptswitch.material.pages.material.LikeMaterial;

public class MaterialLikeForm {
    @Parameter(defaultPrefix = BindingConstants.LITERAL, value = "_self")
    @Property
    private String target;
    @Property
    private Material material = new Material();
    @InjectPage
    private LikeMaterial likeMaterial;
    @Inject
    private Logger logger;

    @SetupRender
    void init() {
        // material=new Material();
    }

    @OnEvent(component = "like")
    Object like() {
        return likeMaterial.withInit(material, 50, 1);
    }
}
